package java8;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class LambdaStreamFlatMap {
    public static void main(String[] args) {

        List<String> words = Arrays.asList("Hello", "world");

        words.stream()
                .map(w -> Arrays.stream(w.split("")))//这里返回的是管道流
                .forEach(System.out::println);

        //FlatMap 针对多维的，管道里面还有管道，数组里面还有数组
        List<String> collect = words.stream()
                .flatMap(w -> Arrays.stream(w.split("")))
                .collect(Collectors.toList());

        collect.forEach(System.out::println);
    }
}
